package com.shanxi.cz.module.biz.dal.mysql.ammeterbasicinfo;

import java.util.*;

import com.shanxi.cz.framework.common.pojo.PageResult;
import com.shanxi.cz.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.shanxi.cz.framework.mybatis.core.mapper.BaseMapperX;
import com.shanxi.cz.module.biz.dal.dataobject.ammeterbasicinfo.AmmeterBasicInfoDO;
import org.apache.ibatis.annotations.Mapper;
import com.shanxi.cz.module.biz.controller.admin.ammeterbasicinfo.vo.*;

/**
 * 电表基础信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface AmmeterBasicInfoMapper extends BaseMapperX<AmmeterBasicInfoDO> {

    default PageResult<AmmeterBasicInfoDO> selectPage(AmmeterBasicInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AmmeterBasicInfoDO>()
                .likeIfPresent(AmmeterBasicInfoDO::getAreaName, reqVO.getAreaName())
                .likeIfPresent(AmmeterBasicInfoDO::getAmmeterName, reqVO.getAmmeterName())
                .eqIfPresent(AmmeterBasicInfoDO::getAddress, reqVO.getAddress())
                .eqIfPresent(AmmeterBasicInfoDO::getTimesV, reqVO.getTimesV())
                .eqIfPresent(AmmeterBasicInfoDO::getTimesA, reqVO.getTimesA())
                .eqIfPresent(AmmeterBasicInfoDO::getSingleRate, reqVO.getSingleRate())
                .eqIfPresent(AmmeterBasicInfoDO::getBaudrate, reqVO.getBaudrate())
                .eqIfPresent(AmmeterBasicInfoDO::getProtocol, reqVO.getProtocol())
                .eqIfPresent(AmmeterBasicInfoDO::getTripState, reqVO.getTripState())
                .eqIfPresent(AmmeterBasicInfoDO::getOnlineState, reqVO.getOnlineState())
                .betweenIfPresent(AmmeterBasicInfoDO::getAddDate, reqVO.getAddDate())
                .betweenIfPresent(AmmeterBasicInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AmmeterBasicInfoDO::getId));
    }

}